Parent and Child variable
In Glific, one flow can be linked to another flow. The main flow in this case is the parent flow and the linked on is the child flow.
Variables defined in Parent flow can be accessed in child flow and vice versa.
In below example, two flows are created. We will see how to access variables across flows.
- Parent
- Child
Access variable in child flow, which was defined in parent flow
Parent flow has variable defined with name state
1 . Create a flow (parent).
2 . Define a variable. In this example the variable name is state
3 . Call another flow (child)
4 . Access variable created in parent flow.
Syntax to access any variable of parent flow is @results.parent.variablename like in this example the variable name is state . The syntax will be @results.parent.state.input
Access variable in parent flow , which was defined in child flow.
1 . Define a variable in child flow. In this example the variable name is City
2 . Access the variable in parent flow.
Syntax to access any variable of child flow is @results.child.variablename like in this example the variable name is city . The syntax will be
@results.child.city.input
Your Parent and Child flows will look like this
Parent Flow
Child Flow
Flow results will look like